<cfcomponent extends="queries">

	<!---Need to call BASE functions--->
    <cfset BASE = CreateObject("component", "base") />
   
    
    
    <!--- Get Notes --->
    <cffunction name="funcGetNotes" returntype="query">    
    	<cfargument default="-1" name="EmployeeID" type="numeric" required="no" />
        <cfargument default="-1" name="StepActionID" type="numeric" required="no" />
        
        <cfquery name="qryGetNotes" datasource="#Session.DataSource#">
            <!---scf_GetCommentsByStepType 1, #intEmpID# - Scott's old Stored Procedure--->
            Select 
            	Notes 
            From 
            	StepActions
            Where 
            	EmployeeID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.EmployeeID#" /> AND 
                StepID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.StepActionID#" />
        </cfquery>
        
    	<cfreturn qryGetNotes />
    </cffunction>
    <!--- Get Notes --->   
    
    
    
    
    <!--- Update Step2 Employees --->
    <cffunction name="funcUpdateStep2Employee" returntype="any">    
    	<cfargument default="" name="FORM" required="yes" />
        
        <cfset retObj = {} />   
        
        <!---can't figure out way I can't use listToArray(ARGUMENTS.FORM.FrequencyID, ':')[1] in queryparam on Prod--->
        <cfset weirProdServerThing = listToArray(ARGUMENTS.FORM.FrequencyID, ':') />     
        
        <cfquery name="qryUpdateStep2Employee" datasource="#Session.DataSource#">
			<!---
			scf_UpdateEmployee #intEmpID#, '#strFirst#', '#strMI#', '#strLast#', '#strPref#',
			<cfif trim(strHomePhone) EQ "">NULL<cfelse>'#strHomePhone#'</cfif>, 
			<cfif trim(strCellPhone) EQ "">NULL<cfelse>'#strCellPhone#'</cfif>, 
			<cfif trim(strWorkPhone) EQ "">NULL<cfelse>'#strWorkPhone#'</cfif>, 
			<cfif trim(strWorkExt) EQ "" or not isnumeric(strWorkExt) EQ 1>NULL<cfelse>#strWorkExt#</cfif>, 
			NULL, '#strEmail#', NULL, NULL, NULL, NULL, NULL, NULL, #intPosID#, #intSupID#, #intDeptID#, 
			NULL, NULL, NULL, '#dteEstStart#', #bolExempt#, #bolFullTime#, #bolSeasonal#, #bolPrimary#, #intEmpCodeID#, #intSHID#, 
			#intWorkersCompID#, #intCompTypeID#, #intFreqID#, #intHrsWk#, #fltPayRate#, #bolOfferAccepted#, #intDaily#, #intShiftID#, 
			NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '#strCostCode#', #bolBenefits#, #bolLeave# - Scott's old stored procedure
			--->
                    
            UPDATE 
            	Employee
            SET
            	First = <cfqueryparam cfsqltype="cf_sql_varchar" value="#ARGUMENTS.FORM.First#" />,
                Middle = <cfqueryparam cfsqltype="cf_sql_varchar" value="#ARGUMENTS.FORM.MI#" />,
                Last = <cfqueryparam cfsqltype="cf_sql_varchar" value="#ARGUMENTS.FORM.Last#" />,
                PreferredName = <cfqueryparam cfsqltype="cf_sql_varchar" value="#ARGUMENTS.FORM.Preferred#" />,
                CostCode = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.FORM.CostCode#" />,
                <cfif isDefined('ARGUMENTS.FORM.Benifits') >
                	Benifits = <cfqueryparam cfsqltype="cf_sql_bit" value="1" />,
                <cfelse>
                	Benifits = <cfqueryparam cfsqltype="cf_sql_bit" value="0" />, 
                </cfif>
                <cfif isDefined('ARGUMENTS.FORM.Leave') >
                	Leave = <cfqueryparam cfsqltype="cf_sql_bit" value="1" />,
                <cfelse>
                	Leave = <cfqueryparam cfsqltype="cf_sql_bit" value="0" />, 
                </cfif>
                HomePhone = <cfqueryparam cfsqltype="cf_sql_varchar" value="#BASE.CleanPhone(ARGUMENTS.FORM.HomePhone)#" />,
                CellPhone = <cfqueryparam cfsqltype="cf_sql_varchar" value="#BASE.CleanPhone(ARGUMENTS.FORM.CellPhone)#" />,
                WorkPhone = <cfqueryparam cfsqltype="cf_sql_varchar" value="#BASE.CleanPhone(ARGUMENTS.FORM.WorkPhone)#" />,
                WorkPhoneExt = <cfqueryparam cfsqltype="cf_sql_varchar" value="#ARGUMENTS.FORM.WorkPhoneExt#" />,
                Email = <cfqueryparam cfsqltype="cf_sql_varchar" value="#ARGUMENTS.FORM.Email#" />,
                PositionID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.FORM.PositionID#" />,
                DeptID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.FORM.DeptID#" />,
                SupervisorID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.FORM.SupervisorID#" />,
                EmpCodeID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.FORM.EmpCodeID#" />,
                EstStartDate = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.FORM.EstStartDate#" />,
                SalaryHourlyID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.FORM.SalaryHourlyID#" />,
                ShiftID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.FORM.ShiftID#" />,
                HoursPerWeek = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.FORM.HoursPerWeek#" />,
                <cfif isDefined('ARGUMENTS.FORM.Primary') >
                	[Primary] = <cfqueryparam cfsqltype="cf_sql_bit" value="1" />,
                <cfelse>
                	[Primary] = <cfqueryparam cfsqltype="cf_sql_bit" value="0" />, 
                </cfif>
                <cfif isDefined('ARGUMENTS.FORM.Exempt') >
                	Exempt = <cfqueryparam cfsqltype="cf_sql_bit" value="1" />,
                <cfelse>
                	Exempt = <cfqueryparam cfsqltype="cf_sql_bit" value="0" />, 
                </cfif>
                <cfif isDefined('ARGUMENTS.FORM.FullTime') >
                	FullTime = <cfqueryparam cfsqltype="cf_sql_bit" value="1" />,
                <cfelse>
                	FullTime = <cfqueryparam cfsqltype="cf_sql_bit" value="0" />, 
                </cfif>
                <cfif isDefined('ARGUMENTS.FORM.Seasonal') >
                	Seasonal = <cfqueryparam cfsqltype="cf_sql_bit" value="1" />,
                <cfelse>
                	Seasonal = <cfqueryparam cfsqltype="cf_sql_bit" value="0" />, 
                </cfif>                
                Daily = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.FORM.Daily#" />,
                WorkersCompID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.FORM.WorkersCompID#" />,
                CompTypeID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.FORM.CompTypeID#" />,
                FrequencyID = <cfqueryparam cfsqltype="cf_sql_integer" value="#weirProdServerThing[1]#" />,
                PayRate = <cfqueryparam cfsqltype="cf_sql_float" value="#ARGUMENTS.FORM.PayRate#" />,
                <cfif isDefined('ARGUMENTS.FORM.Decline') >
                	OfferAccepted = <cfqueryparam cfsqltype="cf_sql_bit" value="0" />
                <cfelse>
                	OfferAccepted = <cfqueryparam cfsqltype="cf_sql_bit" value="1" />
                </cfif>
        	WHERE 
            	ID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.FORM.EmpID#" />         
        </cfquery>
        
        <cfset SUPER.funcUpdateAction(ARGUMENTS.FORM.StepID, Session.intUserRosettaID, replace(trim(ARGUMENTS.FORM.Notes),"'","''","all")) />
        
        <cfif !isDefined('ARGUMENTS.FORM.Decline') >
        	<cfset SUPER.funcInsertAction(ARGUMENTS.FORM.EmpID, 3) />
        </cfif>
        
        <cfset retObj.QUERIES.GetPositionInfo = SUPER.funcGetPositionCodes(ARGUMENTS.FORM.PositionID) />
        <cfset retObj.QUERIES.GetDepts = SUPER.funcGetDepts(ARGUMENTS.FORM.DeptID) />
        <cfset retObj.QUERIES.GetSalaryHourly = THIS.funcGetSalaryHourly(ARGUMENTS.FORM.SalaryHourlyID) />
        <cfset retObj.QUERIES.GetFrequency = SUPER.funcGetFrequency( weirProdServerThing[1] ) />
        <cfset retObj.FORM = ARGUMENTS.FORM />
        
    	<cfreturn retObj />
    </cffunction>
    <!--- Update Step2 Employees --->
    
    
    
    
    <!--- Get Salary Hourly --->
    <cffunction name="funcGetSalaryHourly" returntype="query">
    	<cfargument default="-1" name="PersonCodeIDNo" required="no" />
        
        <cfquery name="qryGetSalaryHourly" datasource="#Session.DataSourceWFCDB#">
            SELECT 
            	PersonCodeIDNo as ID, PersonCode
            FROM 
            	tSY_Person_Codes
            WHERE 
            	PersonCodeIDNo = <cfqueryparam cfsqltype="cf_sql_varchar" value="#ARGUMENTS.PersonCodeIDNo#" />                
        </cfquery>
        
    	<cfreturn qryGetSalaryHourly />
    </cffunction>
    <!--- Get Salary Hourly --->
    

    
    
          
</cfcomponent>